//
//  SlideBarCell.m
//  SlideTabBar
//
//  Created by Mr.LuDashi on 15/6/30.
//  Copyright (c) 2015年 李泽鲁. All rights reserved.
//


#import "SlideBarCell.h"
#import "LXMovieBriefView.h"

@interface SlideBarCell ()

@property (nonatomic, weak) LXMovieBriefView *movieBriefView;

@property (nonatomic, weak) LXMovieBriefView *movieBriefView1;

@end

@implementation SlideBarCell

- (void)setVideos:(NSArray *)videos
{
    if (videos != nil) {
        _videos = videos;
    }
    
    self.movieBriefView.video = videos[0];
    self.movieBriefView1.video = videos[1];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initSubViews];
    }
    return self;
}

/**
 *  初始化子控件
 */
- (void)initSubViews
{
    LXMovieBriefView *movieBriefView = [[LXMovieBriefView alloc]init];
    self.movieBriefView = movieBriefView;
    [self addSubview:movieBriefView];
    
    LXMovieBriefView *movieBriefView1 = [[LXMovieBriefView alloc]init];
    self.movieBriefView1 = movieBriefView1;
    [self addSubview:movieBriefView1];
    
}

/**
 *  布局子控件
 */
- (void)layoutSubviews
{
    LXMovieBriefView *movieBriefView = self.movieBriefView;
    CGFloat movieBriefViewX = SlideBarCellMargin;
    CGFloat movieBriefViewY = SlideBarCellMargin;
    CGFloat movieBriefViewW = (self.contentView.frame.size.width - SlideBarCellMargin * 3) / 2;
    CGFloat movieBriefViewH = self.contentView.frame.size.height;
    movieBriefView.frame = CGRectMake(movieBriefViewX, movieBriefViewY, movieBriefViewW, movieBriefViewH);
    
    LXMovieBriefView *movieBriefView1 = self.movieBriefView1;
    CGFloat movieBriefView1X = CGRectGetMaxX(movieBriefView.frame) + SlideBarCellMargin;
    CGFloat movieBriefView1Y = movieBriefViewY;
    CGFloat movieBriefView1W = movieBriefViewW;
    CGFloat movieBriefView1H = movieBriefViewH;
    movieBriefView1.frame = CGRectMake(movieBriefView1X, movieBriefView1Y, movieBriefView1W, movieBriefView1H);
}

@end
